Optimal. Leaf size=202 \[ -\frac {d (a d (1+n)-b c (1+n (3+p))) x \left (a+b x^n\right )^{1+p}}{b^2 (1+n+n p) (1+n (2+p))}+\frac {d x \left (a+b x^n\right )^{1+p} \left (c+d x^n\right )}{b (1+2 n+n p)}-\frac {(b c (1+n+n p) (a d-b c (1+n (2+p)))-a d (a d (1+n)-b c (1+n (3+p)))) x \left (a+b x^n\right )^p \left (1+\frac {b x^n}{a}\right )^{-p} \, _2F_1\left (\frac {1}{n},-p;1+\frac {1}{n};-\frac {b x^n}{a}\right )}{b^2 (1+n+n p) (1+n (2+p))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.18, antiderivative size = 197, normalized size of antiderivative = 0.98, number of steps
used = 4, number of rules used = 4, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.210, Rules used = {427, 396, 252,
251} \begin {gather*} -\frac {d x \left (a+b x^n\right )^{p+1} (a d (n+1)-b (c n (p+3)+c))}{b^2 (n p+n+1) (n (p+2)+1)}-\frac {x \left (a+b x^n\right )^p \left (\frac {b x^n}{a}+1\right )^{-p} \left (c (a d-b (c n (p+2)+c))-\frac {a d (a d (n+1)-b (c n (p+3)+c))}{b (n p+n+1)}\right ) \, _2F_1\left (\frac {1}{n},-p;1+\frac {1}{n};-\frac {b x^n}{a}\right )}{b (n (p+2)+1)}+\frac {d x \left (c+d x^n\right ) \left (a+b x^n\right )^{p+1}}{b (n (p+2)+1)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 251
Rule 252
Rule 396
Rule 427
Rubi steps
\begin {align*} \int \left (a+b x^n\right )^p \left (c+d x^n\right )^2 \, dx &=\frac {d x \left (a+b x^n\right )^{1+p} \left (c+d x^n\right )}{b (1+n (2+p))}+\frac {\int \left (a+b x^n\right )^p \left (-c (a d-b (c+c n (2+p)))-d (a d (1+n)-b (c+c n (3+p))) x^n\right ) \, dx}{b (1+n (2+p))}\\ &=-\frac {d (a d (1+n)-b (c+c n (3+p))) x \left (a+b x^n\right )^{1+p}}{b^2 (1+n+n p) (1+n (2+p))}+\frac {d x \left (a+b x^n\right )^{1+p} \left (c+d x^n\right )}{b (1+n (2+p))}-\frac {\left (c (a d-b (c+c n (2+p)))-\frac {a d (a d (1+n)-b (c+c n (3+p)))}{b (1+n+n p)}\right ) \int \left (a+b x^n\right )^p \, dx}{b (1+n (2+p))}\\ &=-\frac {d (a d (1+n)-b (c+c n (3+p))) x \left (a+b x^n\right )^{1+p}}{b^2 (1+n+n p) (1+n (2+p))}+\frac {d x \left (a+b x^n\right )^{1+p} \left (c+d x^n\right )}{b (1+n (2+p))}-\frac {\left (\left (c (a d-b (c+c n (2+p)))-\frac {a d (a d (1+n)-b (c+c n (3+p)))}{b (1+n+n p)}\right ) \left (a+b x^n\right )^p \left (1+\frac {b x^n}{a}\right )^{-p}\right ) \int \left (1+\frac {b x^n}{a}\right )^p \, dx}{b (1+n (2+p))}\\ &=-\frac {d (a d (1+n)-b (c+c n (3+p))) x \left (a+b x^n\right )^{1+p}}{b^2 (1+n+n p) (1+n (2+p))}+\frac {d x \left (a+b x^n\right )^{1+p} \left (c+d x^n\right )}{b (1+n (2+p))}-\frac {\left (c (a d-b (c+c n (2+p)))-\frac {a d (a d (1+n)-b (c+c n (3+p)))}{b (1+n+n p)}\right ) x \left (a+b x^n\right )^p \left (1+\frac {b x^n}{a}\right )^{-p} \, _2F_1\left (\frac {1}{n},-p;1+\frac {1}{n};-\frac {b x^n}{a}\right )}{b (1+n (2+p))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 5.15, size = 140, normalized size = 0.69 \begin {gather*} \frac {x \left (a+b x^n\right )^p \left (1+\frac {b x^n}{a}\right )^{-p} \left (2 c d (1+2 n) x^n \, _2F_1\left (1+\frac {1}{n},-p;2+\frac {1}{n};-\frac {b x^n}{a}\right )+(1+n) \left (d^2 x^{2 n} \, _2F_1\left (2+\frac {1}{n},-p;3+\frac {1}{n};-\frac {b x^n}{a}\right )+c^2 (1+2 n) \, _2F_1\left (\frac {1}{n},-p;1+\frac {1}{n};-\frac {b x^n}{a}\right )\right )\right )}{(1+n) (1+2 n)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.07, size = 0, normalized size = 0.00 \[\int \left (a +b \,x^{n}\right )^{p} \left (c +d \,x^{n}\right )^{2}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [C] Result contains complex when optimal does not.
time = 25.05, size = 143, normalized size = 0.71 \begin {gather*} \frac {a^{p} c^{2} x \Gamma \left (\frac {1}{n}\right ) {{}_{2}F_{1}\left (\begin {matrix} \frac {1}{n}, - p \\ 1 + \frac {1}{n} \end {matrix}\middle | {\frac {b x^{n} e^{i \pi }}{a}} \right )}}{n \Gamma \left (1 + \frac {1}{n}\right )} + \frac {2 a^{p} c d x x^{n} \Gamma \left (1 + \frac {1}{n}\right ) {{}_{2}F_{1}\left (\begin {matrix} - p, 1 + \frac {1}{n} \\ 2 + \frac {1}{n} \end {matrix}\middle | {\frac {b x^{n} e^{i \pi }}{a}} \right )}}{n \Gamma \left (2 + \frac {1}{n}\right )} + \frac {a^{p} d^{2} x x^{2 n} \Gamma \left (2 + \frac {1}{n}\right ) {{}_{2}F_{1}\left (\begin {matrix} - p, 2 + \frac {1}{n} \\ 3 + \frac {1}{n} \end {matrix}\middle | {\frac {b x^{n} e^{i \pi }}{a}} \right )}}{n \Gamma \left (3 + \frac {1}{n}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: TypeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int {\left (a+b\,x^n\right )}^p\,{\left (c+d\,x^n\right )}^2 \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________